package com.ss.android.wenda.c;

import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.ImageView;
import android.widget.TextView;

import com.bytedance.common.utility.UIUtils;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.k.dd;
import com.ss.android.wenda.answer.detail2.NewAnswerDetailActivity;
import com.ss.android.wenda.answer.list.AnswerListActivity;
import com.ss.android.wenda.answer.list.FoldAnswerListActivity;
import com.ss.android.wenda.model.Answer;

public final class a extends dd {
    final class a$a implements View.OnClickListener {
        Answer a;

        public a$a(Answer arg1) {

            this.a = arg1;
        }

        public final void onClick(View arg9) {
            if(this.a != null) {
                if((arg9.getContext() instanceof AnswerListActivity)) {
                    MobClickCombiner.onEvent(arg9.getContext(), "question", "answer", android.support.design.a.x(this.a.mAnsId), 0);
                }
                else if((arg9.getContext() instanceof FoldAnswerListActivity)) {
                    MobClickCombiner.onEvent(arg9.getContext(), "question", "fold_answer");
                }

                NewAnswerDetailActivity.a(arg9.getContext(), this.a.mSchema);
            }
        }
    }

    public int c;
    com.ss.android.wenda.model.response.a d;
    private a$a e;
    private ViewGroup f;
    private ImageView g;
    private TextView h;
    private TextView i;

    public a(com.ss.android.wenda.model.response.a arg1, int arg2) {

        this.d = arg1;
        this.c = arg2;
    }

    public final void a(Object arg6) {
        int v4 = 8;
        if((arg6 instanceof Answer)) {
            if(this.e == null) {
                this.e = new a$a(((Answer)arg6));
            }
            else {
                this.e.a = ((Answer)arg6);
            }

            this.a().setOnClickListener(this.e);
            View v1 = this.b().a.findViewById(com.ss.android.article.browser.R.id.divider_line);
            if(this.d != null && this.d.a == this.c && this.d != null) {
                if(this.f == null) {
                    this.f = (ViewGroup) ((ViewStub)this.a().findViewById(com.ss.android.article.browser.R.id.wenda_category_entrance_stub)).inflate();
                    this.g = this.f.findViewById(com.ss.android.article.browser.R.id.wenda_logo);
                    this.i = this.f.findViewById(com.ss.android.article.browser.R.id.wenda_category_enter_btn);
                    this.h = this.f.findViewById(com.ss.android.article.browser.R.id.wenda_category_introduce_text);
                }

                Resources v0 = this.a().getContext().getResources();
                UIUtils.setVisibility(this.f, 0);
                UIUtils.setVisibility(v1, v4);
                if(this.f == null) {
                    return;
                }

                this.f.setVisibility(View.VISIBLE);
                this.g.setImageResource(com.ss.android.article.browser.R.drawable.ask_card_logo_wap);
                this.i.setTextColor(v0.getColorStateList(com.ss.android.article.browser.R.color.wenda_category_enter_text_color));
                this.h.setText(this.d.b);
                this.h.setTextColor(v0.getColor(com.ss.android.article.browser.R.color.ssxinzi1));
                this.f.setBackgroundResource(com.ss.android.article.browser.R.drawable.mian3);
                b v0_1 = new b(this);
                this.i.setOnClickListener(((View.OnClickListener)v0_1));
                this.f.setOnClickListener(((View.OnClickListener)v0_1));
                return;
            }

            UIUtils.setVisibility(this.f, v4);
            UIUtils.setVisibility(v1, 0);
        }
    }
}

